import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Regulai {
	
	public static void main(String[] args) {
		String [] s = {"fhiahflihjoi","513565"};
		for(String a:s){
			System.out.println(right(a));
		}
		//System.out.println(right(s));
	}
	public static boolean right(String str){
		String check = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
		Pattern pate = Pattern.compile(check);
		Matcher mat = pate.matcher(str);
		return mat.matches();
	}

}
